﻿<?
error_reporting(0);
include("../config/header.php");
?>
<script type='text/javascript'>
	document.title = 'URL编码/解码 —— 在线工具';
</script>
<script language="javascript">
function urlCrypt(){
	var str2='';
	str = $('#Text').val();
	str3 = str.substring(0,7);
	if(str3 == 'http://'){
		str2 = 'http://';
		str = str.substring(7,str.length);
	}
	for(i=0;i<str.length;i++){
		if(str.charCodeAt(i) == '47') str2 += '/';
		else if(str.charCodeAt(i) == '63') str2 += '?';
		else if(str.charCodeAt(i) == '38') str2 += '&';		
		else if(str.charCodeAt(i) == '61') str2 += '='; 
		else if(str.charCodeAt(i) == '58') str2 += ':'; 
		else str2 += '%'+str.charCodeAt(i).toString(16);
	}
	$('#Text').val(str2);
}
</script>
<div class="container">
	<div class="panel panel-primary">
		<div class="panel-heading"><h3 class="panel-title">URL编码/解码</h3></div>
	</div>
	<div class="form-group">
		<label>输入加密信息：</label>
		<textarea style="width:100%;height:250px;" id="Text" class="form-control"></textarea>
		<input type="submit" class="btn btn-lg btn-primary btn-block" onclick="urlCrypt()" value="提交" />
	</div>
</div>
<?php
include("../config/footer.php");
?>